package com.xinyi.reactivemvvmkt.di

import com.xinyi.reactivemvvmkt.sources.remote.NeteaseApi
import com.xinyi.reactivemvvmkt.sources.remote.impl.NeteaseApiImpl
import com.xinyi.reactivemvvmkt.sources.repository.MainRepository
import com.xinyi.reactivemvvmkt.sources.repository.impl.MainRepositoryImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

/**
 * @author 杨耿雷
 * @date 2024/9/25 8:44
 * @description 依赖注入 dependency injection
 */
@Module
@InstallIn(SingletonComponent::class)
class AppModule {

    @Singleton
    @Provides
    fun provideNeteaseApi(): NeteaseApi {
        return NeteaseApiImpl()
    }

    @Singleton
    @Provides
    fun provideMainRepository(neteaseApi: NeteaseApi): MainRepository {
        return MainRepositoryImpl(neteaseApi)
    }
}